<%--
  Created by IntelliJ IDEA.
  User: szq
  Date: 2022/3/24
  Time: 11:18
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<div style="background-color: #ffffff ;width: 90%;height: 75%;margin-left: 5%;margin-top: 1%;min-width: 1px;min-height: 600px;position: relative;max-width: 90%;max-height: 700px;border-radius: 15px;padding-bottom: 10px;">

    <div class="data_list_title" style="margin-left: 20px;margin-top: 10px">
        <br>
        <span class="glyphicon glyphicon-list"></span>&nbsp;记录列表&nbsp;&nbsp;<button class="btn btn-success" type="button" onclick="seeInfo()">说明</button>
        &nbsp;&nbsp;<button class="btn btn-success" type="button" onclick="getDataExcel(4)">导出</button>
    </div>
    <div id="myDiv" style="margin: 20px;margin-top: 10px">
        <%-- 通过JSTl的if标签，判断类型集合是否存在 --%>
        <%--  如果不存在，则显示对应的提示信息（暂未查询到类型数据！） --%>
        <c:if test="${empty page}" >
            <h2>暂未查询到类型数据！</h2>
        </c:if>
        <c:if test="${!empty page}" >
            <%-- 如果存在，通过JSTL的forEach标签进行遍历 --%>
            <table id="myTable" class="table table-hover table-striped">
                <tbody>
                <tr>
                    <th>ID</th>
                    <th>记录类型</th>
                    <th>记录账号</th>
                    <th>记录博客</th>
                    <th>信息</th>
                    <th>其他</th>
                    <th>时间</th>
                </tr>
                    <%-- 遍历类型集合 --%>
                <c:forEach items="${page.dataList}" var="item" varStatus="i">
                    <c:if test="${item.type == '登录失败'}">
                        <tr style="background-color: #d9534f">
                            <td>${item.id}</td>
                            <td >${item.type}</td>
                            <c:if test="${item.userID == -1}">
                                <td >#</td>
                            </c:if>
                            <c:if test="${item.userID > 0}">
                                <td >${item.userID}</td>
                            </c:if>
                            <c:if test="${item.blogID == -1}">
                                <td >#</td>
                            </c:if>
                            <c:if test="${item.blogID > 0}">
                                <td >${item.blogID}</td>
                            </c:if>
                            <td>${item.info}</td>
                            <td>${item.otherInfo}</td>
                            <td><fmt:formatDate value="${item.time}" pattern="yyyy-MM-dd hh:mm:ss"/></td>

                        </tr>
                    </c:if>

                    <c:if test="${item.type != '登录失败'}">
                        <tr>
                            <td>${item.id}</td>
                            <td >${item.type}</td>
                            <c:if test="${item.userID == -1}">
                                <td >#</td>
                            </c:if>
                            <c:if test="${item.userID > 0}">
                                <td >${item.userID}</td>
                            </c:if>
                            <c:if test="${item.blogID == -1}">
                                <td >#</td>
                            </c:if>
                            <c:if test="${item.blogID > 0}">
                                <td >${item.blogID}</td>
                            </c:if>
                            <td>${item.info}</td>
                            <td>${item.otherInfo}</td>
                            <td><fmt:formatDate value="${item.time}" pattern="yyyy-MM-dd HH:mm:ss"/></td>

                        </tr>
                    </c:if>

                </c:forEach>
                </tbody>
            </table>
        </c:if>
    </div>

    <FORM style="margin-left: 20px;" METHOD="get" ACTION="https://www.ip138.com/iplookup.asp" name="ipform" target="_blank">
        <tr><td align="center">IP地址：<input type="text" name="ip" size="16">
            <input type="submit" value="查询"><INPUT TYPE="hidden" name="action" value="2">
        </td></tr></FORM>

    <%-- 设置分页导航 --%>
    <nav style="text-align: center;position: fixed;bottom: 5px;left: 35%;min-width: 30%">
        <ul class="pagination  center">
            <%-- 如果当前不是第一页，则显示上一页的按钮 --%>
            <c:if test="${page.pageNum > 1}">
                <li>

                    <a href="admin?pageNum=${page.prePage}&actionName=record"><span>«</span> </a>

                </li>
            </c:if>
            <%-- 导航页数 --%>
            <c:forEach begin="${page.startNavPage}" end="${page.endNavPage}" var="p">
                <li <c:if test="${page.pageNum == p}">class="active"</c:if> >

                    <a href="admin?pageNum=${p}&actionName=record">${p}</a>
                </li>
            </c:forEach>
            <%-- 如果当前不是最后一页，则显示下一页的按钮 --%>
            <c:if test="${page.pageNum < page.totalPages}">
                <li>

                    <a href="admin?&pageNum=${page.nextPage}&actionName=record">

                        <span>»</span>
                    </a>
                </li>
            </c:if>
        </ul>
    </nav>

</div>

